<template>
  <div class="add">
    <el-form ref="form" :model="form" label-width="80px">
  <el-form-item label="图书编号">
    <el-input v-model="$store.state.bookID"></el-input>
  </el-form-item>
  <el-form-item label="图书名称">
    <el-input v-model="$store.state.title"></el-input>
  </el-form-item>
  <el-form-item label="作者">
    <el-input v-model="$store.state.author"></el-input>
  </el-form-item>
  <el-form-item label="复印份数">
    <el-input v-model="$store.state.copies"></el-input>
  </el-form-item>
  <el-form-item>
    <el-button type="primary" @click="$store.commit('addBook')">添加</el-button>
    <el-button>
      <router-link to="/">返回图书详情页</router-link>
      
    </el-button>
  </el-form-item>
</el-form>
  </div>
</template>

<script>
import { mapState, mapMutations, mapActions, mapGetters } from "vuex";

export default {
  computed: {
    ...mapState(["tableData"]), // 将 tableData 映射为计算属性
  },
  data() {
      return {
        form: {}
    }
  },
}
</script>

